var app = getApp();
Page({
  data: {
    data:[],
  },

//审批
 shenhe(id,type){
  var that =this
  wx.request({
    url: app.apiUrl + '/api/index/jswuperrorkq',
    data: {
       openid:wx.getStorageSync('openid'),
       id:id,
       type:type,
    },
    method: 'POST',
    header: { 'content-type': 'application/x-www-form-urlencoded' },
    success: res=> {
          if(res.data.code == "0"){
            wx.showModal({
              title: '温馨提示',
              content: res.data.msg,
              showCancel: false
            });
          }else{
            wx.showModal({
              title: '温馨提示',
              content: res.data.msg,
              showCancel: false
            });
          }
          this.getdaka()  
    }
  })
 },
  //修改考勤
  dealerror(e){
    var type = e.currentTarget.dataset.type;
    var id = e.currentTarget.dataset.id;
    if(type == 1){
      //通过
      this.shenhe(id,1);
    }else{
      //拒绝
      this.shenhe(id,2);
    }
  
},

//获取异常数据列表
getdaka: function () {
var that =this
wx.request({
  url: app.apiUrl + '/api/index/errorlist',
  data: {},
  method: 'POST',
  header: { 'content-type': 'application/x-www-form-urlencoded' },
  success: res=> {
          that.setData({ data: res.data.data});
  }
})
},
onLoad: function () {
  var that = this;
  if (!wx.getStorageSync('openid')) {
    app.error("请登录后再操作");
    return false;
  }

},

onShow:function(){
  this.getdaka()
}

 
})